#include <iostream>
using namespace std;
constexpr int MAXN = 1000 + 5;
int n, a[MAXN], dp[MAXN];
void solve();
int main() {
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    solve();
}

void solve() {
    for (int i = 0; i < n; i++) {
        dp[i] = 1;
        for (int j = 0; j < i; j++) {
            if (a[i] > a[i - j]) dp[i] = max(dp[i], dp[i - j] + 1);
            else dp[i] = max(dp[i], dp[i - j]);
        }
    }
    cout << dp[n - 1] << endl;
}

constexpr int INF = 1 << 30;
void solve2() {
    fill(dp, dp + n, INF);
    for (int i = 0; i < n; i++) {
        *lower_bound(dp, dp + n, a[i]) = a[i];
    }
    cout << lower_bound(dp, dp + n, INF) - dp << endl;
    
}